#ifndef __BOARD__
#define __BOARD__


#include "point.h"
#include <vector>

class Board{

public:
	// Default constructor
	Board();
	// Get the value at a board location
	char getBoardValue(int x, int y);
	// Get the size of the board
	int getBoardSize();
	// Set the value of a coord on a board 
	void setBoardValue(int x, int y, char val);
	// Print the current board state
	void printBoard();
	// Place a ship on the board with the given start and end coords
	int placeShip(int sx, int sy, int ex, int ey);
	// Generate ships on the board
	void populate();
	// if a ship coord position is directly next to another ship return true else reuturn false
	bool isNeibour(int x, int y);
	// if a ship wont cross with another return true 
	bool clearPath(int x, int y, int dir);
	// if a board has ships that are not destoryed 
	bool shipsLeft();
	// return true if the specified coords are a hit, false otherwise
	bool hitMiss(int x, int y);
	// return a guess coord for the AI
	Point getHit();
	// add a hit to the storage buffer
	void setHit(int ox, int oy);
	// get the number of hits stored in the buffer
	int getNumHits();
	// generate a random set of guess coords
	Point getRandomHit();
	// return true if a coord has alread been guessed, false otherwise
	bool alreadyGuessed(int x, int y);
	// Search for hits using grid lay out
	Point getLineHit();
	// Search for hits using checkerboard layout
	Point getCheckBoardHit();
	// generate coords using pre-defined pattern
	Point getRandomPatternHit();
	// initialise pattern buffer
	void initialisePattern();

private:
	// array that represents a board
	char board[10][10];
	// storage buffer for hits
	std::vector<Point> hits;
	// enumeration of possible ship directions
	enum {down, right, upRight, downRight, downLeft, upLeft, up, left};
	// stores the last point examined on the board by checkerboard search
	Point lastSearch;
	// number of ai moves in checkboard search
	int moves;
	// Vertical to horizontal switch in grid lay out search
	bool isLineSearchVertical;
	// last point examined on the board by grid lay out search
	Point lineSearch;
	// pattern buffer for RandomPatternHit
	std::vector<Point> pattern;

};

#endif
